package com.bw.zg2.http

import com.bw.zg2.Const
import com.bw.zg2.base.BaseResult
import com.bw.zg2.bean.BannerBean
import com.bw.zg2.bean.CartBean
import com.bw.zg2.bean.GoodsBean
import com.bw.zg2.bean.GoodsDetailBean
import com.bw.zg2.bean.GoodsTypeBean
import com.bw.zg2.bean.LoginBean
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.Query

/**
 *
 * @ClassName: ApiService
 * @Description: java类作用描述
 * @Author: zhangyanchao
 * @CreateDate: 2024/9/12 12:07 PM
 * @Version: 1.0
 */
interface ApiService {

    @POST("/user/loginjson")
    //suspend 挂起函数
    suspend fun login(@Body map: Map<String, String>): BaseResult<LoginBean>

    @POST("/user/register")
    suspend fun register(@Body map: Map<String, String>): BaseResult<LoginBean>

    @GET("/banner/json")
    suspend fun getBanner(): BaseResult<List<BannerBean>>

    @GET("goods/info")
    suspend fun getGoodsList(
        @Query("category_id") category_id: Int,
        @Query("currentPage") currentPage: Int,
        @Query("pageSize") pageSize: Int
    ): BaseResult<GoodsBean>

    @GET("/goods/category")
    suspend fun getGoodsCategory(): BaseResult<List<GoodsTypeBean>>

    @GET(Const.URL_GOODS_DETAIL)
    suspend fun getGoodsDetail(@Query("goods_id") goods_id: Int): BaseResult<GoodsDetailBean>

    @GET(Const.URL_GOODS_SELECTCART)
    suspend fun getGoodsCarts(): BaseResult<List<CartBean>>

    @POST(Const.URL_GOODS_ADDCART)
    suspend fun addGoodsCar(@Body map: Map<String, Int>): BaseResult<String>

    @POST(Const.URL_GOODS_DELETECART)
    suspend fun deleteGoodsCar(@Body map: Map<String, String>): BaseResult<String>


    @POST("gateway.do")
    suspend fun gateway(@Body map: Map<String, String>): BaseResult<String>


}